// pages/me/me.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    nickName: "未登录",
    address: "获取地址",
    avatar: "https://6d69-mini-env-0gt0sj79500ac3d5-1306924020.tcb.qcloud.la/source/common/boy.png?sign=6b01e8ecbdb865b8619b553c41e472de&t=1635680849",
    list: [123,123,235134,2324],
    slideButtons: [{
      text: '普通',
      src: '../../src/icon/icon-file.png', // icon的路径
    },{
      text: '普通',
      extClass: 'test',
      src: '../../src/icon/icon-file.png', // icon的路径
    },{
      type: 'warn',
      text: '警示',
      extClass: 'test',
        src: '../../src/icon/icon-file.png', // icon的路径
    }]
  },
  slideButtonTap(e) {
    console.log('slide button tap', e.detail)
  },
  getUserDetail() {
    wx.navigateTo({
      url: '../../pages/message/message'
    })
  },
  navigateAuthorDeclaration() {
    wx.navigateTo({
      url: '../../pages/author_declaration/author_declaration'
    })
  },
  navigateMiniDeclaration() {
    wx.navigateTo({
      url: '../../pages/mini_declaration/mini_declaration'
    })
  },
  getLocation() {
    var that = this
    wx.chooseLocation({
      latitude: 116,
      longitude: 39,
      success: res => {
        var address = res.address
        that.setData({
          address: address
        })
      }
    })
  },
  toLogin() {
    wx.navigateTo({
      url: '../../pages/login/login'
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },
  slideButtonTap(e) {
    console.log('slide button tap', e.detail)
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

    var that = this
    wx.getStorage({
      key: "_USERINFO",
      success: res => {

        // console.log(res.data.userInfo.avatarUrl)
        console.log(this.avatar)
        that.setData({
          avatar: res.data.userInfo.avatarUrl,
          nickName: res.data.userInfo.nickName,
          isLogin: getApp().globalData.isLogin
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})